/**
 * 
 */
package com.ms.game.slot.base;

import com.xpec.c4.message.MessageTypes;
import com.xpec.c4.service.module.task.TaskAsyncCommand;

/**
 * @author TW15010
 *
 */
public class SlotDmSeatStatusBroadcastAsync<T, T2> extends TaskAsyncCommand {
	/**
	 * 廣播機台歷史記錄的消息類型 {@link MessageTypes}
	 */
	private int sendHistoryMessageType = 0;

	/**
	 * 廣播機台座位狀態的消息類型 {@link MessageTypes}
	 */
	private int sendSeatStatusMessageType = 0;

	private DMAsyncHsitoryManger<T, T2> seatUpdateInfoManager;

	@Override
	public void asyncExecute() throws Exception {
		if (sendHistoryMessageType != 0) {
			seatUpdateInfoManager.sendHistoryDataToClient(sendHistoryMessageType);
		}

		if (sendSeatStatusMessageType != 0) {
			seatUpdateInfoManager.sendSeatStatusToClient(sendSeatStatusMessageType);
		}
	}

	@Override
	public void execute() throws Exception {
		if (sendHistoryMessageType != 0) {
			seatUpdateInfoManager.setSendHistoryWorking(false);
		}

		if (sendSeatStatusMessageType != 0) {
			seatUpdateInfoManager.setSendSeatStatusWorking(false);
		}
	}

	public void setSeatUpdateInfoManager(DMAsyncHsitoryManger<T, T2> seatUpdateInfoManager) {
		this.seatUpdateInfoManager = seatUpdateInfoManager;
	}

	public void setSendHistoryMessageType(int sendHistoryMessageType) {
		this.sendHistoryMessageType = sendHistoryMessageType;
	}

	public void setSendSeatStatusMessageType(int sendSeatStatusMessageType) {
		this.sendSeatStatusMessageType = sendSeatStatusMessageType;
	}
}
